package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.pojo.DtsBrand;
import com.qf.pojo.DtsRegion;
import com.qf.service.DtsRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @author YDW
 * projectName:shop-manage
 * time:2022/5/24 9:43
 * description:
 */
@Service
public class DtsRegionServiceImpl implements DtsRegionService {

    @Autowired
    DtsRegionMapper regionMapper;

    @Override
    public IPage<DtsRegion> queryPage(Integer page, Integer limit, Integer code, String name) {
        IPage<DtsRegion> ipage=new Page<>(page,limit);
        QueryWrapper qw=new QueryWrapper<>();
        if(code!=null){
            qw.like("code",code);
        }
        if(!StringUtils.isEmpty(name)){
            qw.like("name",name);
        }
        regionMapper.selectPage(ipage,qw);
        return ipage;
    }
}
